package chapter02

object Test11_String2 {
  def main(args: Array[String]): Unit = {
    //判断是否是回文字符串
    def isRe(s:String):Boolean={
      var s1 = ""
      for(i<-s.length-1 to 0 by -1){
        s1 = s1+s(i)
      }
      if(s1==s) true else false
    }
    def isRe1(s:String):Boolean = {
      if(s==s.reverse) true else false
    }
    println(isRe("abccba"))
    println(isRe1("abc"))
  }
}
